package com.rd.student.jike.class1.fangzhou.day0731;

import java.util.ArrayList;

public class Test04 {
    public static void main(String[] args) {
        ArrayList<Integer> List = new ArrayList<>();
        while (List.size() < 20) {
            int random = (int) (Math.random() * 50);
            if (!List.contains(random)) {
                System.out.println("添加元素：" + random);
               List.add(random);
            } else {
                System.out.println("重复元素：" + random);
            }
        }
        System.out.println(List);

    }
}
